package com.howells.time.module.account.view;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.howells.time.R;
import com.howells.time.base.activity.BaseActivity;
import com.howells.time.base.utils.StatusBarUtil;
import com.howells.time.base.utils.ToastShow;
import com.howells.time.module.account.presenter.ChangePswPresenter;
import com.howells.time.module.account.presenter.ChangePswPresenterImp;


/**
 * Created by Administrator on 2016.4.7.
 */
public class ChangePswActivity extends BaseActivity implements ChangePswView{
    private ChangePswPresenter changePswPresenter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        changePswPresenter=new ChangePswPresenterImp(this);
        StatusBarUtil.setColor(this,0);
        setContentView(R.layout.account_changepassword);
        ((TextView)findViewById(R.id.top_pannel_title)).setText("修改密码");
    }

    public void onClick(View view){
        switch (view.getId()){
            case R.id.top_pannel_back:
                finish();
                break;
            case R.id.act_me_setting_help_feedback_commit:
                String oldtext= ((EditText) findViewById(R.id.account_verify_modify_passwrod_original)).getText().toString();
                String newtext= ((EditText) findViewById(R.id.account_verify_modify_passwrod_new)).getText().toString();
                if(oldtext.length()>0&&newtext.length()>0){
                    changePswPresenter.changepsw(oldtext, newtext);
                }else {
                    ToastShow.ToastShort(this,"请输入完整");
                    return;
                }
                break;
        }
    }


    @Override
    public void changesuccess() {
        ToastShow.ToastShort(this,"修改成功");
        finish();
    }
}
